﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GcmpApplicationInterface.h"

namespace gcmp
{
    constexpr int AUTH_ERROR_CODE = 2;
    /// \brief  授权
    class GCMP_APPLICATION_INTERFACE_EXPORT IAuthenticationManager
    {
    public:
        /// \brief 获取授权接口
        static IAuthenticationManager* Get();

        /// \brief 验证授权是否有效
        ///
        /// \return true 表示通过，false 表示不通过
        virtual bool IsAuthorized() const = 0;

        /// \brief 设置激活服务器
        ///
        /// \param server 服务器地址
        virtual void SetServer(const std::string& server) = 0;

        /// \brief 激活授权码
        ///
        /// \param server 服务器地址
        /// \return  true 表示激活成功，false 表示失败
        virtual bool Activate(const std::string& code) = 0;

        /// \brief 当授权无效或激活失败时，获取错误消息
        ///
        /// \return  错误消息内容
        virtual std::wstring GetErrorMessage() const = 0;

    };

}
